﻿using System;

using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CeeSharpBlackJack
{
    class StandardDeck : Deck
    {
        private List<PlayingCard> deck = new List<PlayingCard>();

        public void addCard(PlayingCard card)
        {
            deck.Add(card);
        }

        public void shuffle()
        {
            Random r = new Random();
            for (int index = 0; index < deck.Count; index++)
            {
                int number = (int)(Math.Floor(r.NextDouble()*(deck.Count - 1 - index)) + index);
                PlayingCard card = deck[index];
                deck[index] = deck[number];
                deck[number] = card;
            }
        }

        public object deal()
        {
            PlayingCard card = deck[0];
            deck.RemoveAt(0);
            return card;
        }
    }
}
